<?php
class Zend_View_Helper_ShowArticleIndex {
	public function showArticleIndex($view) {
		$articles = $view->articles;
		$str = '';
		$str .= '<table class="article">
		<tr>
			<th class="title"> Title </th>
			<th> Status </th>
			<th> Date </th>
			<th> Author </th>
			<th> User </th>
			<th> Article ID </th>
		</tr>';
		foreach($articles as $entry){
			$str .= '<tr>';
			
			$str .= '<td>';
			$str .= $entry->title;
			$str .= '</td>';
			
			$str .= '<td>';
			$str .= $entry->status;
			$str .= '</td>';
			
			$str .= '<td>';
			$str .= $entry->created_date;
			$str .= '</td>';
			
			$str .= '<td>';
			$str .= $entry->author;
			$str .= '</td>';
			
			$str .= '<td>';
			$str .= $entry->created_user_name;
			$str .= '</td>';	
				
			$str .= '<td>';
			$str .= $entry->article_id;
			$str .= '</td>';											
			// Edit link
			$str .= '<td><a href = ';
			$edit = $view->url(array("controller"=>"article",
					"action"=>"edit",
					"article_id"=>$entry->article_id));
			$str .= $edit;
			$str .= '>Edit</a></td>';

			// Delete link
			$str .= '<td><a href = ';
			$delete = $view->url(array("controller"=>"article",
					"action"=>"delete",
					"article_id"=>$entry->article_id));
			$str .= $delete;
			$str .= '>Delete</a></td>';	
			
			$str .= '</tr>';
		}
		$str .= '</table>';
		echo $str;
	}
}